package com.airsystem.pos.bengkel.model;

import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import com.airsystem.pos.bengkel.component.DesktopFrame;
import com.airsystem.pos.bengkel.entity.JenisLayanan;

/**
 * @author Fanny Irawan Sutawanir (fannyirawans@gmail.com)
 */
public class MasterServiceTypeModel extends DesktopFrame {
	protected GridBagLayout baseLayout = new GridBagLayout();
	protected GridBagLayout panelLayout = new GridBagLayout();

	protected JPanel basePanel = new JPanel();
	protected JPanel buttonPanel = new JPanel();

	protected JLabel namaLabel = new JLabel();

	protected JTextField namaField = new JTextField();
	protected JTextField idField = new JTextField();

	protected JButton searchButton = new JButton();
	protected JButton saveButton = new JButton();
	protected JButton updateButton = new JButton();
	protected JButton deleteButton = new JButton();
	protected JButton cancelButton = new JButton();

	protected JenisLayanan jenisLayanan;

	public MasterServiceTypeModel() {
		super();
	}

	protected JenisLayanan getComponentData() {
		JenisLayanan jenisLayanan = new JenisLayanan();

		if (!idField.getText().trim().isEmpty()) {
			jenisLayanan.setId(Long.valueOf(idField.getText().trim()));
		}
		jenisLayanan.setNama(namaField.getText().trim());

		return jenisLayanan;
	}
}